home *** CD-ROM | disk | FTP | other *** search
- /* output of `obscure -s stripcr.c obscure.silly' */
-
-
- #include <string.h>
- #include <stdio.h>
-
- #include <ctype.h>
- #include <assert.h>
-
- int main(int foo, char **bar)
- {
- FILE *baz = stdin, *quux = stdout;
- int fred;
-
- if (foo > 1) {
- if (!strcmp(bar[1], "-h") || foo > 3) {
- fprintf(stderr, "\
- %s: remove carriage returns from input file\n\
- usage: %s [input] [[output]]\n", bar[0], bar[0]);
- exit(0);
- } else {
- if (strcmp(bar[1], "-") != 0 &&
- (baz = fopen(bar[1], "rb")) == NULL) {
- fprintf(stderr, "%s: no such file\n", bar[1]);
- exit(1);
- }
- }
- if (foo == 3) {
- if ((quux = fopen(bar[2], "wb")) == NULL) {
- fprintf(stderr, "%s: cannot open output file\n", bar[2]);
- exit(1);
- }
- }
- }
- while ((fred = fgetc(baz)) != EOF)
- if (fred != 0x0d)
- fputc(fred, quux);
-
- fclose(baz);
- fclose(quux);
-
- return 0;
- }
-
-
-